package com.lonely.order.support.detail;

import cn.hutool.core.lang.Assert;
import cn.hutool.extra.spring.SpringUtil;
import com.lonely.order.enums.OrderEnum;
import com.lonely.order.support.detail.impl.GetOrderDetailFromLocal;
import com.lonely.order.support.detail.impl.GetOrderDetailFromShein;

import java.util.Objects;

/**
 * @author : 黄志标
 * @date: 2025/7/14 13:53
 * @description:
 */
public class GetOrderDetailFactory {


    /**
     * 根据订单来源获取对应的订单详情
     *
     * @param orderSource
     * @return
     */
    public static GetOrderDetail getInstance(Integer orderSource) {
        Assert.notNull(orderSource, "入参为空");

        if (Objects.equals(orderSource, OrderEnum.OrderSourceEnum.SHEIN.getOrderSource())) {
            return SpringUtil.getBean(GetOrderDetailFromShein.class);
        }
        return SpringUtil.getBean(GetOrderDetailFromLocal.class);
    }

}
